package com.itheima.mq;

import com.itheima.utils.RedisUtil;
import com.itheima.utils.SMSUtils;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author jshstart
 * @creat 2020-11-18 20:03
 */
@Component
public class SmsCodeConsumer {
    @RabbitListener(queues = "sms_queue")
    public void reciver(String telephone){
//        String code = SMSUtils.registerSendCode(telephone, "8888");
        String code="8888";
        RedisUtil.set("sms:code:"+telephone,code,5l, TimeUnit.MINUTES);
    }
}
